data is not posted in $_POST variable using AJAX [migrated]
Posted
by
Oliver
on Server Fault
See other posts from Server Fault
or by Oliver
Published on 2012-06-01T01:37:02Z
Indexed on
2012/06/01
4:43 UTC
Read the original article
Hit count: 577
Im having a problem in one of my script. Server is running in php, and im using AJAX to post data. Here is my script.
PHP script:
0){ echo "Search Result :"; for ($x=0;$xProject Name:   ".mysql_result($result,$x,"projname")."
"; echo "APMS ID:   ".mysql_result($result,$x,"apmsid")."
"; echo "Prefix/es:   ".mysql_result($result,$x,"projprefix")."
"; echo "Usage Type:   ".mysql_result($result,$x,"usagetype")."
"; echo "Rate:   ".mysql_result($result,$x,"projrate")."
"; echo "Offer Details:   ".mysql_result($result,$x,"offerdetails")."
"; } }else{ echo "No results found ..."; } }else{ echo "Problems encountered while processing the data ..."; } ?>
JS Script: function QueryPrefix() { var xmlhttp; var pStr = document.getElementById('Editbox2'); var htmlHolder = document.getElementById('Html1'); var butStr = document.getElementById('Button1');
if (pStr.value.length == 0){
alert("Please enter a value on the box provided!");
return;
}
pStr.value="";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
htmlHolder.innerHTML=xmlhttp.responseText;
butStr.disabled=false;
}
}
butStr.disabled=true;
xmlhttp.open("POST","searchutype.php",false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("pStr=" + pStr.value);
}
© Server Fault or respective owner